package com.sunwayworld.basemodule.basedata.reporttemplate.resource.impl;

import com.sunwayworld.basemodule.basedata.reporttemplate.resource.LimsWordTemplateResource;
import com.sunwayworld.basemodule.basedata.reporttemplate.service.LimsWordTemplateService;
import com.sunwayworld.cloud.lims.reporttemplate.resource.impl.LimsReportTemplateResourceImpl;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@LogModule("报告模板表")
@RestController
@GikamBean
public class LimsWordTemplateResourceImpl extends LimsReportTemplateResourceImpl implements LimsWordTemplateResource {

    @Autowired
    private LimsWordTemplateService limsWordTemplateService;

    @Override
    public LimsWordTemplateService getService() {
        return limsWordTemplateService;
    }

    @PostMapping("/samplePrint/{id}/pdf")
    @Override
    public String samplePrintPdf(@PathVariable Long id, RestJsonWrapperBean wrapperBean) {
        return getService().samplePrintPdf(wrapperBean, id);
    }

    @Override
    @Log(value = "预览生成PDF报告", type = LogType.CONTROLLER)
    @PostMapping("/{id}/action/generator/pdf")
    public String generatorPDFReport(@PathVariable Long id, RestJsonWrapperBean wrapperBean) {
        return getService().generatorPDFReport(id, wrapperBean);
    }
}
